/**
 * @param {number[]} nums
 * @return {number}
 */
var waysToSplitArray = function(nums) {
    const sumArr = []
    const halfSum = nums.reduce((sum, item) => {
        sum+=item
        sumArr.push(sum)
        return sum
    }, 0) / 2
    console.log(halfSum, sumArr)
    let result = 0
    nums.map((item, index) => {
        if (index == 0) {
            item >= halfSum ? result++ : undefined;
        } else if (index < nums.length - 1) {
            item + sumArr[index-1] >= halfSum ? result++ : undefined;
        }
        console.log('111',item, result)
    })
    return result
};


const nums = [-1,-2]
console.log(waysToSplitArray(nums))